package com.yuke.cloud.service.wmc.controller.frontend;

import com.yuke.cloud.common.util.wrapper.WrapMapper;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.wmc.dto.WmsExcelImportDto;
import com.yuke.cloud.service.wmc.dto.WmsStockOutDto;
import com.yuke.cloud.service.wmc.service.WmsStockOutService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wms/excel")
@Slf4j
public class WmsExcelImportController {

    @Autowired
    private WmsStockOutService wmsStockOutService;
    //
    @PostMapping("/stockOut")
    public Wrapper<List<WmsStockOutDto>> checkShopName(@RequestBody WmsExcelImportDto wmsExcelImportDto){
        if (wmsExcelImportDto.getWmsStockOutDto()==null||wmsExcelImportDto.getWmsStockOutDto().size()<1){
            return WrapMapper.ok(null);
        }
        List<WmsStockOutDto> list = wmsStockOutService.excelStockOut(wmsExcelImportDto);

        return WrapMapper.ok(list);
    }
}
